package com.uam.core.config;


import com.uam.core.business.RouteInItThread;
import com.uam.core.business.RouteStatusInfo;
import com.uam.core.scheduler.PointInfoScheduler;
import com.uam.core.service.DatasService;
import com.uam.core.service.RouteService;
import com.uam.core.service.SectorService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @author Administrator
 * @description: 项目启动执行方法
 */
@Component
@Slf4j
public class ApplicationRunnerImpl implements ApplicationRunner {

    @Autowired
    private SectorService sectorService = null;

    @Autowired
    private RouteStatusInfo routeStatusInfo;

    private long interval=5000L;

    @Autowired
    private RouteService routeService;

    @Autowired
    private DatasService datasService = null;
    /**
     * @description: 启动成功开始监控
     */
    @Override
    public void run(ApplicationArguments args) {
        sectorService.getStatCount();
        PointInfoScheduler.signalStrength=routeService.getAllBaseStations();
//        datasService.initDatas();
        new Thread( new RouteInItThread(this.routeStatusInfo,this.interval)).start();
    }

}

